﻿using System;
using System.Collections.Generic;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Ol : HtmlElement
	{
		public Ol() : base(OlDescription.Instance) { }

		public Li AddLi(string text = null, bool htmlEncode = true) { return AddControl(new Li(text, htmlEncode)) as Li; }
		public Li AddLi(string text, string href, bool htmlEncode = true) { return AddControl(new Li(text, href, htmlEncode)) as Li; }

		public uint? Start { get { return GetAttributeUint("start"); } set { SetAttribute("start", value); } }
		public bool Reversed { get { return GetAttributeBool("reversed"); } set { SetAttribute("reversed", value); } }
		public string Type { get { return this["type"]; } set { this["type"] = value; } }
	}
	public class OlDescription : HtmlElementDescription
	{
		public static readonly OlDescription Instance = new OlDescription();
		private OlDescription() : base("ol") { }
		public override Type ControlType { get { return typeof(Ol); } }
		public override bool IsFlowElement { get { return true; } }
		public override string Description { get { return "list (or sequence) of items; that is, a list in which the items are intentionally ordered, such that changing the order would change the meaning of the list."; } }
		public override IEnumerable<HtmlElementDescription> PermittedElements { get { yield return LiDescription.Instance; } }
	}
}
